package com.SpringBoot.controller;

import com.SpringBoot.common.Result;
import com.SpringBoot.echarts.InportShop;
import com.SpringBoot.echarts.SaleShop;
import com.SpringBoot.echarts.ShopProvider;
import com.SpringBoot.service.GoodsService;
import com.SpringBoot.service.InportService;
import com.SpringBoot.service.SalesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author jsx on 2023/3/6
 **/
@RestController
@RequestMapping("/echarts")
public class EchartsController {

    @Autowired
    private GoodsService goodsService;
    @Autowired
    private SalesService salesService;
    @Autowired
    private InportService inportService;

    //统计供应商的商品最多三个供应商
    @RequestMapping("/shop")
    public Result shop(){
        List<ShopProvider> shopProviders = goodsService.selectMaxThreeProvider();
        Result result = new Result();
        result.setData(shopProviders);
        return result;
    }

    @RequestMapping("/sale")
    public Result sale(){
        List<SaleShop> saleShops = salesService.selectMaxThreeShop();
        Result result = new Result();
        result.setData(saleShops);
        return result;
    }

    @RequestMapping("inport")
    public Result inport(){
        List<InportShop> inportShops = inportService.selectThreeShop();
        Result result = new Result();
        result.setData(inportShops);
        return result;
    }
}
